import { Component, Emit, Prop } from 'vue-facing-decorator'
import Render from '@/render/Render'
import toNative from '@/utils/toNative'
import type { DescItemDto } from '@/components/render-descriotion/Index'
import RenderDescription from '@/components/render-descriotion/Index'
import { EditOutlined, InfoCircleOutlined, UserOutlined } from '@ant-design/icons-vue'
import { getCompanyDetail, updateSaasCompany } from '@/api/company'
import { Button, message, Tag } from 'ant-design-vue'
import ToolTipText from '@/components/tooltip-text/Index'
import type { CompanyProductInfoDto, PayWageInfoDto } from '@/api/company/types'
import renderModal, { getModelValue, type FormModalDto } from '@/components/modal/Modal'
import { alipayWithdraw } from '@/api/customer'
import type { LongInsuranceCaseListDto, ReportCaseResultDto } from '@/api/insurance/period/types'
import { AccidentTypeCnEnum, HurtStatusCnEnum } from '@/const/enum'
import PreviewVideoOrImage from '@/components/preview-media/PreviewVideoOrImage'
import dayjs from 'dayjs'
@Component
export class BasicInfo extends Render {
    @Prop() claimData!: LongInsuranceCaseListDto<ReportCaseResultDto>

    @Emit('refresh')
    handleRefresh() {}

    get clientInfoData() {
        return [
            {
                label: '出险人',
                value: this.claimData?.outDangerUserName,
            },
            {
                label: '保障区间',
                value: this.claimData?.insureDate + '-' + dayjs(this.claimData?.insureDate).add(24, 'hour').format('YYYY-MM-DD HH:mm:ss'),
            },
            {
                label: '出险时间',
                value: this.claimData?.insurStartTime,
            },
            {
                label: '投保方案',
                value: this.claimData?.reportPlan,
            },
            {
                label: '出险人身份证',
                value: this.claimData?.idCardNo,
            },
            {
                label: '事故类型',
                value: AccidentTypeCnEnum[this.claimData?.accidentType]
            },
            {
                label: '出险人手机',
                value: this.claimData?.outDangerPhone,
            },
            {
                label: '伤情是否严重',
                value: HurtStatusCnEnum[this.claimData?.hurtStatus]
            },
            {
                label: '出险地点',
                value: this.claimData?.outDangerPlace
            },
            {
                label: '报案材料',
                value: this.claimData?.isUploaded ? '已上传' : '未上传'
            },
            {
                label: '报案人手机号',
                value: this.claimData?.reportPhone
            },
            {
                label: '事故视频',
                value: this.claimData?.params?.fileUrl?.length ? <PreviewVideoOrImage src={this.claimData?.params?.fileUrl.map(i => i.fileUrl)} /> : '--'
            },
            {
                label: '是否住院',
                value: this.claimData?.hospitalStatus ? '是' : '否',
            },
            {
                label: '就诊医院',
                value: this.claimData?.visitHospital
            },
            {
                label: '事故经过',
                value: this.claimData?.accidentDetails
            },
        ] as DescItemDto[]
    }

    get indemnityAmount() {
        return [
            {
                label: '预估金额',
                value: this.claimData?.estimateMoney,
            },
            {
                label: '最终金额',
                value: this.claimData?.finalMoney,
            },

        ] as DescItemDto[]
    }

    get insuranceInfo() {
        return [
            {
                label: '投保方案',
                value: this.claimData?.companyPlanName,
            },
            {
                label: '投保日期',
                value: this.claimData?.insurStartTime,
            },
            {
                label: '保险公司',
                value: this.claimData?.insurCompanyName,
            },
            {
                label: '被派遣单位',
                value: this.claimData?.serveCompanyName,
            },
            {
                label: '工种',
                value: <><Tag color="processing">{this.claimData?.occupationLevel}类</Tag>{this.claimData?.occupationName}</>,
            },
        ] as DescItemDto[]
    }

    render() {
        return <div>
            <div class="flex items-center mb-20px">
                <UserOutlined />
                <div class="text-black-200 font-bold ml-8px">案件资料</div>
            </div>
            <RenderDescription row={2} labelWidth={140} renderData={this.clientInfoData} />
            
            <div class="flex items-center my-20px">
                <UserOutlined />
                <div class="text-black-200 font-bold ml-8px">赔款金额</div>
            </div>
            <RenderDescription row={2} labelWidth={140} renderData={this.indemnityAmount} />
            
            <div class="flex items-center my-20px">
                <UserOutlined />
                <div class="text-black-200 font-bold ml-8px">投保信息</div>
            </div>
            <RenderDescription row={2} labelWidth={140} renderData={this.insuranceInfo} />
        </div>
    }
}

export default toNative<{ claimData: LongInsuranceCaseListDto<ReportCaseResultDto>}, { refresh: () => void}>(BasicInfo)